#include <bits/stdc++.h>
using namespace std;

struct FastIO {
	inline FastIO& operator >> (short& x) {
		x = 0;
		char f = 0, ch = getchar();
		while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
		while (ch <= '9' && ch >= '0') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
		return x = (f ? -x : x), *this;
	}
	inline FastIO& operator >> (int& x) {
		x = 0;
		char f = 0, ch = getchar();
		while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
		while (ch <= '9' && ch >= '0') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
		return x = (f ? -x : x), *this;
	}
	inline FastIO& operator >> (long long& x) {
		x = 0;
		char f = 0, ch = getchar();
		while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
		while (ch <= '9' && ch >= '0') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
		return x = (f ? -x : x), *this;
	}
	inline FastIO& operator >> (double& x) {
		x = 0;
		char f = 0, ch = getchar();
		double d = 0.1;
		while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
		while (ch <= '9' && ch >= '0') x = x * 10 + (ch ^ 48), ch = getchar();
		if (ch == '.') {
			ch = getchar();
			while (ch <= '9' && ch >= '0') x += d * (ch ^ 48), d *= 0.1, ch = getchar();
		}
		return x = (f ? -x : x), *this;
	}
} rin;

#define ll long long
#define uint unsigned int
#define reg register
#define ld long double
#define uint unsigned int
#define ull unsigned long long
#define qint const int&
#define qll const ll&
#define quint cosnt uint&
#define qull const ull&
#define endl "\n"

inline void qmod(int& x, const int& mod) {
	x = x >= mod ? x - mod : x;
}

const int N = 1e5 + 10, NN = 3010;
int n, a, b, x;
int ver[N << 1], nxt[N << 1], hd[N], nE, d[N];
inline void add(int u, int v) {
	ver[++nE] = v;
	nxt[nE] = hd[u];
	hd[u] = nE;
}
namespace Sol1 {
	int dep[N], p[N][20], tI[N], tO[N], timer;
	void dfs(int u, int fa) {
		dep[u] = dep[fa] + 1;
		tI[u] = ++timer;
		p[u][0] = fa;
		for (int i = 1; (1 << i) <= n; ++i)
			p[u][i] = p[p[u][i - 1]][i - 1];
		for (int e = hd[u]; ~e; e = nxt[e]) {
			int v = ver[e];
			if (v == fa) continue;
			dfs(v, u);
		}
		tO[u] = ++timer;
	}
	inline bool up(int u, int v) {
		if (v == n + 1) return false;
		return u == 0 || (tI[u] <= tI[v] && tO[v] <= tO[u]);
	}
	inline int LCA(int u, int v) {
		if (up(u, v)) return u;
		if (up(v, u)) return v;
		for (int i = 19; i >= 0; --i)
			if (!up(p[u][i], v))
				u = p[u][i];
		return p[u][0];
	}
	inline int len(int u, int v) {
		return dep[u] + dep[v] - (dep[LCA(u, v)] << 1);
	}
	map<tuple<int, int, bool>, int> res;
	int solve(int u, int pre, bool tp) {
//		cout << u << " " << pre << " " << tp << endl;
		if (res.count({u, pre, tp})) return res[{u, pre, tp}];
		if (tp == 0) {
			int ans = 0;
			for (int i = 1; i <= n; ++i) {
//				cout << len(u, i) << " " << up(LCA(u, i), pre) << endl;
				if (len(u, i) == a && !up(LCA(u, i), pre))
					ans = max(ans, solve(i, u, 1));
			}
			if (ans == 0) ans = solve(u, -1, 1);
			return res[{u, pre, tp}] = ans;
		} else {
			if (pre == -1) {
				int ans = 0x3f3f3f;
				for (int i = 1; i <= n; ++i)
					if (len(i, u) <= b && dep[i] > dep[u]) ans = min(ans, i);
				return res[{u, pre, tp}] = ans;
			} else {
				int ans = 0x3f3f3f;
				for (int i = 1; i <= n; ++i)
					if (len(i, u) <= b)
						ans = min(ans, solve(i, pre, 0));
				return res[{u, pre, tp}] = ans;
			}
		}
	}
	void solve() {
		dfs(x, 0);
		cout << solve(x, n + 1, 0) << endl;
	}
}
signed main() {
	freopen("nim.in", "r", stdin);
	freopen("nim.out", "w", stdout);
	rin >> n >> x >> a >> b;
	if (a <= b) {
		cout << 1 << endl;
		return 0;
	}
	memset(hd, -1, sizeof(hd));
	for (int i = 1, u, v; i < n; ++i) {
		rin >> u >> v;
		add(u, v), add(v, u), ++d[u], ++d[v];
	}
	Sol1 :: solve();
	return 0;
}
